package com.ftg.learn.bus.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ftg.learn.bus.VO.BusRegVo;
import com.ftg.learn.bus.VO.FundsStatisticsVo;
import com.ftg.learn.bus.VO.UserRoleNameVo;
import com.ftg.learn.bus.service.impl.StatisticsServiceImpl;
import com.ftg.learn.util.ResEntity;
import com.ftg.learn.util.ResPageEntity;
import com.ftg.learn.util.SelectController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author :[魏英豪]
 * @className :[StatisticsFundsController]
 * @createTime :[2022/3/28 7:47]
 */
@RestController
@RequestMapping("/bus/funds")
@Api(tags = "统计功能查询")
public class StatisticsFundsController {

    @Autowired
    StatisticsServiceImpl service;

    @GetMapping("/showAll")
    @ApiOperation(value = "查询全部经费支出数据")
    public ResPageEntity showAllFunds(@RequestParam int page, @RequestParam int limit){
        Page<FundsStatisticsVo> p = new Page<>(page,limit);
        p.setRecords(service.showAllFunds(p));
        return new ResPageEntity(p);
    }

    @GetMapping("/showAllByName")
    @ApiOperation(value = "经费支出数据模糊查询")
    public ResPageEntity showAllFundsByName(@RequestParam String name,@RequestParam int page, @RequestParam int limit){
        Page<FundsStatisticsVo> p = new Page<>(page,limit);
        p.setRecords(service.showAllFundsByName(p,name));
        return new ResPageEntity(p);
    }

    @GetMapping("/showAllReg")
    @ApiOperation(value = "查询车辆使用情况")
    public ResPageEntity showAllReg(@RequestParam int page, @RequestParam int limit){
        Page<BusRegVo> p = new Page<>(page,limit);
        p.setRecords(service.showAllReg(p));
        return new ResPageEntity(p);
    }

    @GetMapping("/showAllRegByName")
    @ApiOperation(value = "查询车辆使用情况")
    public ResPageEntity showAllRegByName(@RequestParam String name,@RequestParam int page, @RequestParam int limit){
        Page<BusRegVo> p = new Page<>(page,limit);
        p.setRecords(service.showAllRegByName(p,name));
        return new ResPageEntity(p);
    }
}
